package demo.DataStrucAndAlgo.Easy_pritice;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/10/18-10-18-22:19
 * @Description：demo.DataStrucAndAlgo.Easy_pritice
 */
public class TestQianFeng {

    public static void main(String[] args) {
        Person person = new Person("张三",23,"男");
        System.out.println(person);
        person.say("hello");
        System.out.println("计算的结果为：" + person.addNum(23,78));
        person.changeName("Mike");
        System.out.println(person);
    }
}
class Person{
    private String name;
    private int age;
    private String sex;

    public Person() {
    }

    public Person(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    public void say(String msg){
        System.out.println(msg);
    }
    public int addNum(int a, int b){
        return a+b;
    }
    public void changeName(String name){
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                '}';
    }
}
